#include "secondaryplan.h"
#include "ui_secondaryplan.h"
#include "relievepage.h"
#include "logwindow.h"
secondaryPlan::secondaryPlan(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::secondaryPlan)
{
    ui->setupUi(this);
}

secondaryPlan::~secondaryPlan()
{
    delete ui;
}

void secondaryPlan::setInfoCommon(QString DotName, QString siteName)
{

    ui->widget_eeror->hide();
    ui->dotName->setText(DotName);
    ui->siteName->setText(siteName);

    //区域位置
     QList<QList<QString> > Region = DB.showRegion();
     for(int i=0 ; i<Region.size();i++)
     {
       if(Region[i].at(0)==DotName)
       {
           ui->postion->setText(Region[i].at(1));  //位置
       }
     }
    //二级平面图的更换
    QImage *img=new QImage;
    //判断该区域的图片
    if(DotName.contains("原料厂",Qt::CaseSensitive))
    {
        img->load(":/res/pic/1.jpg");
    }
    else if(DotName.contains("研究所",Qt::CaseSensitive))
    {
        img->load(":/res/pic/2.jpg");
    }
    else if(DotName.contains("陶瓷基地",Qt::CaseSensitive))
    {
        img->load(":/res/pic/3.jpg");
    }
    else if(DotName.contains("建材基地",Qt::CaseSensitive))
    {
        img->load(":/res/pic/4.jpg");
    }
    else if(DotName.contains("大楼",Qt::CaseSensitive))
    {
        img->load(":/res/pic/5.jpg");
    }
    else if(DotName.contains("车间1",Qt::CaseSensitive))
    {
        img->load(":/res/pic/6.jpg");
    }
    else if(DotName.contains("车间2",Qt::CaseSensitive))
    {
        img->load(":/res/pic/7.jpg");
    }
    else if(DotName.contains("车间3",Qt::CaseSensitive))
    {
        img->load(":/res/pic/8.jpg");
    }
    else if(DotName.contains("职工宿舍",Qt::CaseSensitive))
    {
        img->load(":/res/pic/9.jpg");
    }
    else
    {
        return;
    }
    ui->pic->setPixmap(QPixmap::fromImage(*img));  //设置图片

}

void secondaryPlan::on_lookHistory_clicked()
{
    LogWindow *log=new LogWindow;
    log->show();
}
